package com.norma.macaron.service.facade.controller.auth;

import com.norma.macaron.common.model.response.BaseResponse;
import com.norma.macaron.common.model.response.ResponseT;
import com.norma.macaron.service.common.client.auth.AuthServiceClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhangchaofeng
 * @date 2020/6/12 0012
 * @description
 */
@RestController
public class AuthController implements AuthServiceClient {

    @Autowired
    AuthServiceClient authServiceClient;

    @Override
    @PostMapping(value = "/v1.0/facade/auth/login",params = {"userName","password"})
    public ResponseT login(String userName, String password) {
        return authServiceClient.login(userName,password);
    }

    @Override
    @PostMapping(value = "/v1.0/facade/auth/wechat/login",params = {"openId","tempId"})
    public ResponseT wechatLogin(String openId, String tempId) {
        return authServiceClient.wechatLogin(openId,tempId);
    }

    @Override
    @PostMapping(value = "/v1.0/facade/auth/sms/login",params = {"phone","smsCode"})
    public ResponseT smsLogin(String phone, String smsCode) {
        return authServiceClient.smsLogin(phone,smsCode);
    }

    @Override
    @PostMapping(value = "/v1.0/facade/auth/logout",params = {"token"})
    public BaseResponse logout(String token) {
        return authServiceClient.logout(token);
    }

    @Override
    @PostMapping(value = "/v1.0/facade/auth/jwt",params = {"uid"})
    public ResponseT userjwt(String uid) {
        return authServiceClient.userjwt(uid);
    }

    @Override
    public ResponseT getCurrentUser(String headerStr) {
        return null;
    }
}
